import request from '@/utils/request'
import linq from 'linq'
export async function get课程设置(XXID,CJPC){
    //?$filter=XXID eq '${XXID}' and CJPC eq '${CJPC}'
    
    let res =  await request({
        url: `/Kcsz?$apply=filter(XXID eq '${XXID}' and CJPC eq '${CJPC}' and 审核状态 eq '通过' and (是否删除 eq 0 or 是否删除 eq null))`,
        method: 'get',
      })
    return res.data.value;
    //
    
}
export async function get课程设置ByID
(XXID,CJPC,ID){
  //?$filter=XXID eq '${XXID}' and CJPC eq '${CJPC}'
  
  
  let res =  await request({
      url: `/Kcsz?$apply=filter(XXID eq '${XXID}' and CJPC eq '${CJPC}'  and ID eq ${ID} and 审核状态 eq '通过' and (是否删除 eq 0 or 是否删除 eq null))`,
      method: 'get',
    })
    
  return res.data.value[0];
  //
  
}
export async function search课程设置(XXID,CJPC,search){
  //

  let res =  await request({
      url: `/Kcsz?$filter=XXID eq '${XXID}' and CJPC eq '${CJPC}' and (contains(KCMC, '${search}') or contains(KCDM, '${search}')) and 审核状态 eq '通过' and (是否删除 eq 0 or 是否删除 eq null) `,
      method: 'get',
      
    })
  return res.data.value;
  //
  
}
export async function bulkAdd课程设置(data){
    //
    
    let res =  await request({
        url: '/Kcsz/BulkAddKcsz',
        method: 'post',
        data:data
      })
    return res.data.value;
    //
    
  }
export async function update课程设置(model){
    let res =  await request({
        url: `/Kcsz(${model.ID})`,
        method: 'put',
        data: model
      })
      return res.data;
}
export async function delete课程设置(model){
    let res = await  request({
        url: `/Kcsz/${model.ID}`,
        method: 'delete',
      })
      return res.data;
}
export async function add课程设置(model){
   
    let res =  await request({
      url: '/Kcsz',
      method: 'post',
      data: model,
    })
    return res.data;
}